//
//  XS_WeChatBindCell.swift
//  XueDao
//
//  Created by Mac on 2020/12/12.
//

import UIKit

protocol XS_WeChatBindCellDelegate {
    func bindCell(bindCell : XS_WeChatBindCell, didClickUnbindBtn: UIButton)
}

class XS_WeChatBindCell: UITableViewCell {
    
    var delegate : XS_WeChatBindCellDelegate?

    @IBOutlet weak var unBindBtn: UIButton!
    @IBOutlet weak var bindLab: UILabel!
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
        unBindBtn.layer.borderWidth = 1;
        unBindBtn.layer.borderColor = UIColor.qmui_color(withHexString: "#AAB1B7")?.cgColor
        
        bindLab.backgroundColor = UIColor(red: 0.16, green: 0.74, blue: 0.61, alpha: 1.00)
    }
    
    func reloadData(){
        let wechat = XS_Singleton.shared.infoModel?.userBO.openId
        unBindBtn.isHidden = wechat?.count ?? 0 == 0
        bindLab.isHidden = !unBindBtn.isHidden
    }

    @IBAction func unBindBtnAction(_ sender: UIButton) {
        if delegate != nil {
            delegate?.bindCell(bindCell: self, didClickUnbindBtn: sender)
        }
    }
    
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
}
